<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<body>
<div th:fragment="nav">
    <nav class="navbar navbar-inverse">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="/">教育论坛</a>
                <a class="navbar-brand" href="/rank/1"><span class="glyphicon glyphicon-signal" aria-hidden="true"></span>&nbsp;排行榜</a>
            </div>
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <form class="navbar-form navbar-left" action="/" method="get">
                    <div class="form-group">
                        <input type="text" class="form-control" name="search" placeholder="寻找你想要的帖子">
                    </div>
                    <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search" aria-hidden="true"/>查找</button>
                </form>
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="/publish" th:if="${session.user} != null">发布</a></li>
                    <li class="dropdown" th:if="${session.user} != null">
                        <a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span th:text="${session.user.getName()}"></span><span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a th:href="@{'/profile/'+${session.user.id}}">个人中心</a></li>
                            <li><a th:href="@{'/profile/'+${session.user.id}+'/questions'}">我的帖子</a></li>
                            <li><a th:href="@{'/profile/'+${session.user.id}+'/replies'}">我的回帖</a></li>
                            <li role="separator" class="divider"></li>
                            <li><a href="/logout">退出登录</a></li>
                        </ul>
                    </li>
                    <li th:if="${session.user == null}">
                        <a href="/register">注册</a>
                    </li>
                    <li class="dropdown" th:if="${session.user} == null">
                        <a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">登录<span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="/login">用户名密码登录</a></li>
                            <li role="separator" class="divider"></li>
                            <li><a href="https://gitee.com/oauth/authorize?client_id=8e24f0db9d637f4e6658dd3be86f14a395ea2267e4360579a4ec81b8ee390580&redirect_uri=http://localhost:8887/callback&response_type=code">Gitee账号登录</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
</div>
</body>
